package cn.tedu.csmall.passport.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName: WebMvcConfiguration
 * Package: cn.tedu.csmall.product.config
 * Description webmvc 跨域配置类
 *
 * @version 0.0.1
 * @Author: 大傻
 * @Create:2022/12/6
 */
@Configuration
@Slf4j
public class WebMvcConfiguration implements WebMvcConfigurer {
        public WebMvcConfiguration(){
            log.debug("创建配置类对象：WebMvcConfiguration");
        }
    public void addCorsMappings(CorsRegistry registry){
        registry.addMapping("/**")
                .allowedMethods("*")
                .allowedHeaders("*")
                .allowedOriginPatterns("*")
                .allowCredentials(true)
                .maxAge(3600);

    }
}
